#define _CRT_SECURE_NO_WARNINGS 1
struct ListNode* reverseList(struct ListNode* head) {
    struct ListNode* p;
    struct ListNode* q;
    if (head == NULL || head->next == NULL) return head;
    p = head->next;
    q = head;
    head->next = NULL;
    while (p != NULL)
    {
        q = p;
        p = p->next;
        q->next = head;
        head = q;
    }
    return head;
}